package com.hz.edu.mapper;

import com.hz.edu.model.entity.CourseEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseMapper {

    @Insert("insert into courses values (null, #{course_name},#{course_code},#{teacher_realname},#{teacher_user_id},#{section_count},#{course_time},#{max_student_count},#{course_profile},#{textbook},#{credits_count},#{all_score},#{pass_score} )")
    int addCourse(CourseEntity courseEntity);

    @Select("select * from courses where id = #{id}")
    CourseEntity selectById(@Param("id") Integer id);

    @Select("select * from courses")
    List<CourseEntity> allCourses();

}
